//
//  FirmwareUpVC.m
//  AILock
//
//  Created by 谭亚明 on 2020/7/13.
//  Copyright © 2020 tym. All rights reserved.
//

#import "FirmwareUpVC.h"
#import "EquipmentService.h"
#import "EquipmentModel.h"

@interface FirmwareUpVC ()

@property(nonatomic,strong) EquipmentService *equipSer;
@property(nonatomic,strong) EquipmentModel *equModel;

@property(nonatomic,weak) IBOutlet UILabel *verLab;
@property(nonatomic,weak) IBOutlet UILabel *netVerLab;
@end

@implementation FirmwareUpVC

-(instancetype)initWithEquipmentModel:(EquipmentModel*)model{
    self = [super init];
    if (self) {
        self.equModel = model;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addBackBtnFunc];
    [self addTitle:@"固件升级"];
    [self getEquipmentDetail];
    
}

-(void)getEquipmentDetail{
    TYMWeak(self);
    [self.equipSer getEquipmentinfo:self.equModel.equipmentId completion:^(NSError * _Nonnull error, EquipmentModel * _Nonnull equipmentModel) {
        weakself.equModel = equipmentModel;
        [weakself updateView];
    }];
}

-(EquipmentService*)equipSer{
    if (_equipSer == nil) {
        _equipSer = [[EquipmentService alloc] init];
    }
    return _equipSer;
}

-(void)updateView{
   
    self.verLab.text = self.equModel.softwareVersions;
    self.netVerLab.text = self.equModel.softwareNetworkVersions;
}
    
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
